package com.ruoyi.wechat.api;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wechat.domain.Camp;
import com.ruoyi.wechat.domain.Collect;
import com.ruoyi.wechat.service.ICollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wechat/collect")
public class WxCollectController extends BaseController {

    @Autowired
    private ICollectService collectService;
    /**
     * 查询收藏列表
     */
    @GetMapping("/list")
    public AjaxResult list()
    {
        String userId = SecurityUtils.getLoginUser().getUser().getNickName();
        List<Camp> list = collectService.selectCollectListByUserId(userId);
        return success(list);
    }


    /**
     * 点击收藏按钮
     */
    @PostMapping
    public AjaxResult add(@RequestBody Collect collect)
    {
        return success(collectService.colect(collect));
    }

}
